<?php
   $mtime = microtime();
   $mtime = explode(" ",$mtime);
   $mtime = $mtime[1] + $mtime[0];
   $starttime = $mtime;
ini_set('display_errors', 1);
$dbconn = pg_connect("dbname=BuddhaV1");
//connect to a database named "mary"

//$dbconn = pg_connect("host=192.168.0.200 port=5432 dbname=BuddhaV1 user=buddha_user password=qwe123");
// connect to a database named "mary" on "localhost" at port "5432"

//$dbconn3 = pg_connect("host=sheep port=5432 dbname=BuddhaV1 user=postgres");
//connect to a database named "mary" on the host "sheep" with a username and password

//$conn_string = "host=localhost port=5432 dbname=BuddhaV1 user=postgres";
//$dbconn = pg_connect($conn_string);
//connect to a database named "test" on the host "sheep" with a username and password

//$dbconn = pg_connect("host=localhost options='--client_encoding=UTF8'");
//connect to a database on "localhost" and set the command line parameter which tells the encoding is in UTF-8

if (!$dbconn) {
  echo "An error occured.\n";
  exit;
}

$result = pg_query($dbconn, "SELECT * FROM users limit 100000");
if (!$result) {
  echo "An error occured.\n";
  exit;
}

while ($row = pg_fetch_row($result)) {
  echo "User_ID: $row[0]  facebook_id: $row[1] First_Name: $row[2]  Last_Name: $row[3]  EmailAddr: $row[5]";
  echo "<br />\n";
}
   $mtime = microtime();
   $mtime = explode(" ",$mtime);
   $mtime = $mtime[1] + $mtime[0];
   $endtime = $mtime;
   $totaltime = ($endtime - $starttime);
   echo "This page was generated in ".$totaltime." seconds"; 

?>
